package com.ruoyi.web.controller.manage;

import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.manage.domain.request.AreaDetailsRequest;
import com.ruoyi.manage.domain.request.LocationRequest;
import com.ruoyi.manage.service.IAppLocationAllService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author: wwy
 * @Date: 2021/1/7 11:09
 */
@Api("移动端获取位置信息")
@RestController
@RequestMapping("/api")
public class AppLocationAllController {
    @Autowired
    private IAppLocationAllService appLocationAllService;
    /**
     * 获取位置信息
     * @return
     */
    @ApiOperation("获取位置信息")
    @PostMapping("/getLocation")
    public AjaxResult getLocation(@RequestBody LocationRequest locationRequest){
        return appLocationAllService.getLocation(locationRequest);
    }

    /**
     * 获取城市
     * @return
     */
    @ApiOperation("获取城市信息")
    @GetMapping("/getCity")
    public AjaxResult getCity(){
        //return appLocationAllService.getCity();
        return appLocationAllService.getCityNew();
    }

    /**
     * 获取辖区
     * @param locationRequest
     * @return
     */
    @ApiOperation("获取辖区信息")
    @PostMapping("/getArea")
    public AjaxResult getArea(@RequestBody LocationRequest locationRequest){
        //return appLocationAllService.getArea(locationRequest);
        return appLocationAllService.getAreaNew(locationRequest);
    }

    /**
     * 获取所在高速
     * @param locationRequest
     * @return
     */
    @ApiOperation("获取高速信息")
    @PostMapping("/getStreet")
    public AjaxResult getStreet(@RequestBody LocationRequest locationRequest){
        //return appLocationAllService.getStreet(locationRequest);
        return appLocationAllService.getStreetNew(locationRequest);
    }

    /**
     * 获取辖区详情
     * @return
     */
    @ApiOperation("获取辖区信息")
    @PostMapping("/getAreaDetails")
    public AjaxResult getAreaDetails(@RequestBody AreaDetailsRequest areaDetailsRequest){
        return appLocationAllService.getAreaDetails(areaDetailsRequest);
    }
}
